﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:huddle="http://schemas.huddledmasses.org/wpf/controls"
    xmlns:sysio="clr-namespace:System.IO;assembly=mscorlib"
    xmlns:diag="clr-namespace:System.Diagnostics;assembly=System"
    >

    <Style TargetType="{x:Type ListView}">
        <Setter Property="Background" Value="{Binding Path=Background, ElementName=buffer, Mode=Default}" />
        <Setter Property="Foreground" Value="{Binding Path=Foreground, ElementName=buffer, Mode=Default}" />
        <Setter Property="BorderThickness" Value="0" />
    </Style>

    <Style TargetType="GridViewColumnHeader">
        <Setter Property="BorderThickness" Value="0,0,2,2" />
        <Setter Property="Foreground" Value="{Binding Path=Foreground, ElementName=buffer, Mode=Default}"/>
        <Setter Property="Background" Value="{Binding Path=Background, ElementName=buffer, Mode=Default}"/>
        <!--
		<Setter Property="Background">
			<Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF223B84" Offset="1"/>
                    <GradientStop Color="#FF57A0F4" Offset="0.5"/>
                    <GradientStop Color="#FF4B94EC" Offset="0.5"/>
                </LinearGradientBrush>
        	</Setter.Value>
		</Setter>
		-->
    </Style>

    <!-- 
   **** Define XAML templates for types in the PowerShell pipeline. There are two here as samples, 
   **** but we need to do this with slightly more sophistication, because in both of these cases...
   **** the templates only /really/ work with SOME of the items they're typed for (see commments)
   -->
    <!-- This Template is for FileInfo, but it really only handles picture file types -->
    <DataTemplate DataType="{x:Type sysio:FileInfo}">
        <StackPanel Width="100px" Orientation="Vertical" Margin="2">
            <Image Source='{Binding Path=FullName}'/>
            <Label Content="{Binding Path=Name}" 
                   Background="{Binding Path=Background, ElementName=buffer, Mode=Default}"
                   Foreground="{Binding Path=Foreground, ElementName=buffer, Mode=Default}"
                   />
            <StackPanel.ToolTip>
                <ToolTip Content="{Binding Path=FullName}" />
            </StackPanel.ToolTip>
        </StackPanel>
    </DataTemplate>
   <DataTemplate DataType="{x:Type sysio:DirectoryInfo}">
      <StackPanel Width="100px" Orientation="Vertical" Margin="2">
         <Image Source='pack://application:,,,/PoshWpf;component/Artwork/Folder237x237.png'/>
         <Label Content="{Binding Path=Name}" 
                   Background="{Binding Path=Background, ElementName=buffer, Mode=Default}"
                   Foreground="{Binding Path=Foreground, ElementName=buffer, Mode=Default}"
                   />
         <StackPanel.ToolTip>
            <ToolTip Content="{Binding Path=FullName}" />
         </StackPanel.ToolTip>
      </StackPanel>
   </DataTemplate>

   <!-- This Template is for Process, but it only handles processes with Windows! -->
    <DataTemplate DataType="{x:Type diag:Process}">
        <StackPanel MaxWidth="150" Orientation="Vertical" Margin="2">
            <huddle:ThumbnailImage WindowSource='{Binding Path=MainWindowHandle}' />
            <Label Content="{Binding Path=ProcessName}" 
                   Background="{Binding Path=Background, ElementName=buffer, Mode=Default}"
                   Foreground="{Binding Path=Foreground, ElementName=buffer, Mode=Default}"
                   />
            <StackPanel.ToolTip>
                <ToolTip Content="{Binding Path=Name}" />
            </StackPanel.ToolTip>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>